package com.hnevc.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class InputStreamReaderDemo {

	public static void main(String[] args) throws IOException {
		InputStream in = new FileInputStream("D:\\data.txt");
		InputStreamReader reader = new InputStreamReader(in);
		char[] buffer = new char[1024];
		int len = reader.read(buffer);
		reader.close();
		
		String data = new String(buffer,0,len);
		System.out.println(data);
		
		
		OutputStream out = new FileOutputStream("D:\\data.txt");
		OutputStreamWriter writer = new OutputStreamWriter(out);
		writer.write(data +" ____1");
		writer.close();
		
	}

}
